define (require, exports, module) ->
  # 基础服务
  base_api = require 'mods/api/base_api'
  # 定义组件
  module.exports = 

    # 查询字典
    getDict: (params) ->
      url = "/dict_query?res_id=104"
      return base_api.postRequestByParams url, params

    # 保存字典
    saveDict: (params) ->
      url = "/dict_save?res_id=102"
      return base_api.postRequestByParams url, params

    # 修改字典
    updateDict: (params) ->
      url = "/dict_update?res_id=107"
      return base_api.postRequestByParams url, params

    # 删除字典
    removeDict: (params) ->
      url = "/dict_remove?res_id=103"
      return base_api.postRequestByParams url, params

    # 查询组件内容
    getCompDatas: (params) ->
      url = "/comp_query_some_all?res_id=85"
      if !!params
        for k, v of params
          if 0 is v?.length
            return Promise.resolve {data: []}
      return base_api.postRequestByParams url, params

    # 字典管理模糊查询
    getSearchDict: (params) ->
      url = '/dict_back_search?dict_id=' + params.dict_id + '&dict_name=' + params.dict_name + '&pageNum=' + params.pageNum
      return base_api.getRequest url